import moment from "moment"
import mixin from "./mixin"
import CustomFormItemWrap from "../../common/CustomFormItemWrap"
// 定义一个混入对象
const customMixin = {
  data(){
    return {
      size: "default",
      placeholder: "请输入",
      valueFormat: "YYYY-MM-DD HH:mm:ss"
    }
  },
  props: {
    ...mixin.props,
    title: {
      type: String,
      default: ""
    },
    colon: {
      type: Boolean,
      default: true
    },
    options: {
      type: Array,
      default: () => []
    }
  },
  methods: {
    ...mixin.methods,
    disabledTime(dateTime){
      return dateTime && dateTime < moment().endOf('day')
    },
    handleChange(value ,key, componentKey){
      if (this.isPreview){
        console.log(value, key)
        this.$emit("valueChange", {
          value ,key, componentKey
        })
      }
    }
  },
  components: {
    CustomFormItemWrap
  }
}

export default customMixin
